#include "LED.h"
#include "driver/gpio.h"
//esp_err_t gpio_config(const gpio_config_t *pGPIOConfig);
//esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level);
#define LED_PIN 4
esp_err_t LED_Init(){
    //定义结构体变量
    gpio_config_t ledGpioConfigStructure;
    ledGpioConfigStructure.intr_type=GPIO_INTR_DISABLE;
    //推挽输出
    ledGpioConfigStructure.mode=GPIO_MODE_OUTPUT;
    //位操作，gpio4
    ledGpioConfigStructure.pin_bit_mask=(uint64_t)(1 << LED_PIN);
    //上拉输入，下拉
    ledGpioConfigStructure.pull_down_en=GPIO_PULLDOWN_DISABLE;
    //上拉输入默认是高电平
    ledGpioConfigStructure.pull_up_en=GPIO_PULLUP_ENABLE;
    return gpio_config(&ledGpioConfigStructure);

}

void LED_ON(){
    gpio_set_level(GPIO_NUM_4,0);
}

void LED_OFF(){
    gpio_set_level(GPIO_NUM_4,1);
}